<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>ADMIN</title>
    <link rel="stylesheet" href="./css/admin/base.css">
    <link rel="stylesheet" href="./css/admin/app.css">
</head>

<body>
    <div class="app-page">
        <div class="app-page-header">
            <div class="app-breadcrumb">
                <a>通用模块</a>
                <a>列表</a>
                <a>详情</a>
            </div>
            <div class="page-title">详情</div>
        </div>
        <div class="app-page-content">
            <div class="app-card">
                <div class="app-card-body">
                    <form class="form">
                        <div class="form-item row">
                            <div class="label">
                                <label>标题</label>
                            </div>
                            <div class="body">
                                <input type="text" data-name="标题" data-rule="required">
                            </div>
                        </div>
                        <div class="form-item row">
                            <div class="label">
                                textarea
                            </div>
                            <div class="body">
                                <textarea name=""></textarea>
                            </div>
                        </div>
                        <div class="form-item row">
                            <div class="label">
                                文件上传
                            </div>
                            <div class="body">
                                <!--
                            data可选属性
                            input-name
                            limit
                            url
                            fieldname
                        -->
                                <div class="upload upload-file z-mab" data-input-name="files" data-limit="0" data-url="http://xc-dmp.37226.com/api/upload" data-fieldname="files">
                                    <div class="upload-list upload-list-text"></div>
                                    <div class="upload-tips">随便上传</div>
                                    <div class="upload-error"></div>
                                    <div class="input-opacity">
                                        <input type="file" class="input" accept="image/gif,image/jpeg,image/jpg,image/png" multiple="multiple">
                                        <a class="z-btn z-default"><i class="fa fa-upload"></i> 上传</a>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="form-item row">
                            <div class="label">
                                图片上传
                            </div>
                            <div class="body">
                                <div class="upload upload-image" data-input-name="images" data-limit="0" data-url="http://xc-dmp.37226.com/api/upload" data-fieldname="files">
                                    <div class="upload-list upload-list-image"></div>
                                    <div class="upload-tips">只能上传jpg/png文件</div>
                                    <div class="upload-error"></div>
                                    <div class="upload-loading">
                                        <i class="fa fa-cog fa-spin"></i> 图片上传中...
                                    </div>
                                    <div class="input-opacity">
                                        <input type="file" class="input" accept="image/gif,image/jpeg,image/jpg,image/png" multiple="multiple">
                                        <a class="z-btn z-default"><i class="fa fa-upload"></i> 上传</a>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="z-btn-group" style="margin-bottom:0;">
                            <a class="btn-submit z-btn z-primary">保存</a>
                            <a href="./list.html" class="layer-close z-btn z-default">返回</a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <script src="lib/jquery.min.js"></script>
    <script src="lib/layer-v3.1.1/layer/layer.js"></script>
    <script src="js/popup.js"></script>
    <script src="js/form.js"></script>
    <script src="js/admin/app.js"></script>
    <script src="js/admin-upload.js"></script>
    <script>
        // 保存
        var form = $(".form").form({
            submitSelector: ".form .btn-submit",
            msg: function(msg) {
                popup.tipsTop(msg, 'warning');
            },
            submit: function() {

                var data = {};

                $.each($(".form").serializeArray(), function(index, field) {
                    if (data[field.name]) {
                        data[field.name] += "," + field.value;
                    } else {
                        data[field.name] = field.value;
                    }
                })

                console.log('提交的数据');
                console.log(data);
            }
        })
    </script>
</body>

</html>